<?php
namespace app\app\controller\v1;
use app\app\Appbase;

class Material extends Appbase 
{
	
	/**
	* 获取素材列表
	* /app/v1/material/index
	* 不需要登录 
	* @is_need_login true
	*/
	public function index(){
		try {
			$res =  model('Material')
				->where('status',1)
				->page(input('pageIndex') ?: 1,input('pageSize') ?: 20)
				->select();
			return $this->ReSucess($res);	
		} catch (Exception $e) {
			throw new \think\Exception( $e );
		}
	}
	
	
	/**
	* 获取素材列表明细
	* /app/v1/material/detail
	* 不需要登录 
	* @is_need_login true
	*/
	public function detail($id){
		try {
			$res =  model('Material')->get($id);
			return $this->ReSucess($res);	
		} catch (Exception $e) {
			throw new \think\Exception( $e );
		}
	}
	
}



